package com.dailyblue.java.commons.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static Integer getAge(String date) {
        Date nowDate = new Date();
        int year = Integer.parseInt(date.substring(0, 4));
        int nowYear = nowDate.getYear() + 1900;
        return nowYear - year;
    }

    public static String getNowDate() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(new Date());
    }
}
